<template>
	<view class="self">
		<aha-navbar	title="个人中心" />
		<!-- 我的信息 -->
		<view
			class="card"
			style="padding: 10px 20px 15px 20px;"
		>
			<MyInfo ref="myInfo" />
		</view>
		<!-- 入口 -->
		<view
			class="card"
			style="padding: 30px 15px;"
		>
			<EntryCard ref="EntryCard" />
		</view>
		<!-- 荣誉 -->
		<view
			class="card"
			style="padding: 0 20px;"
		>
			<Honors />
		</view>
		<AhaTabbar />
	</view>
</template>

<script>
import { getUserInfo } from '@/utils/user'
import { getShareAppData } from '@/utils/index'
import MyInfo from './components/MyInfo'
import EntryCard from './components/EntryCard'
import Honors from './components/Honors'

export default {
  components: {
    MyInfo,
    EntryCard,
    Honors
  },
  computed: {
    /**
		 * 判断是否为管理员
		 */
    is_admin() {
      return getUserInfo().role.id === 2
    },
  },
  onShow() {
    this.$refs.myInfo.initData()
    this.$refs.EntryCard.loadUnread()
  },
  onShareAppMessage() {
    return getShareAppData(`${ getUserInfo().userInfo.nickname }邀您加入Aha口袋`)
  },
}
</script>

<style lang="scss" scoped>
.self {
  min-height: 100vh;
  padding: 0 30px;
  background-color: $primary5;

  .card {
    margin-top: 30px;
    background-color: #ffffff;
    border-radius: $radiusLarge;
  }
}
</style>
